<?php
include_once "conn.php";
$n=is_numeric($_GET['n'])?$_GET['n']:exit('No Net!');

$rs = $db->query("SELECT * FROM ".DB_PREFIX."qqs where (isht>0 or ists>0) and (nextht<'$now' or nextht IS NULL) and sidzt=0");
while($row=$rs->fetch()){ 
	if($config['crontype']){
		$qid=$row['qid'];
		$qq=$row['qq'];
		$sid=$row['sid'];
		$next=date("Y-m-d H:i:s",time()+60*60*8-10);
		$sql='';
		if($row['isht']) $sql.="lastht='$now',";
		if($row['ists']) $sql.="lastts='$now',";
		@$db->exec("update ".DB_PREFIX."qqs set {$sql}nextht='$next' where qid='$qid'");
		
		if($row['ists']){
			$ts = file_get_contents('http://ebook.3g.qq.com/user/v3/normalLevel/sign?sid='.$sid.'&g_ut=2');
			if($_GET['get']){
				echo $ts;
			}
		}

		if($row['isht']){
			$ht = file_get_contents('http://wap.flower.qzone.com/cgi-bin/get_profile_page?sid=' . $sid . '&B_UID=' . $qq);
			if($_GET['get']){
				echo $ht;
			}
			if (preg_match('/浇花/', $ht)) {
				$url='http://wap.flower.qzone.com/cgi-bin/plant_flower?act=rain&B_UID=' . $qq . '&sid=' . $sid . '&g_ut=2';
				$html=file_get_contents($url);
				if($_GET['get']){
					echo $html;
				}
			}
			if (preg_match("/修剪/", $ht)) {
				$url='http://wap.flower.qzone.com/cgi-bin/plant_flower?act=love&B_UID=' . $qq . '&sid=' . $sid . '&g_ut=2';
				$html=file_get_contents($url);
				if($_GET['get']){
					echo $html;
				}
			}
			if (preg_match("/日照/", $ht)) {
				$url='http://wap.flower.qzone.com/cgi-bin/plant_flower?act=sun&B_UID=' . $qq . '&sid=' . $sid . '&g_ut=2';
				$html=file_get_contents($url);
				if($_GET['get']){
					echo $html;
				}
			}
			if (preg_match("/施肥/", $ht)) {
				$url='http://wap.flower.qzone.com/cgi-bin/plant_flower?act=nutri&B_UID=' . $qq . '&sid=' . $sid . '&g_ut=2';
				$html=file_get_contents($url);
				if($_GET['get']){
					echo $html;
				}
			}
		}
	}else{
		$urls[]="{$nurl}ht.run.php?cron=".$_GET['cron']."&qid={$row['qid']}{$look}";
	}
}
if(!$config['crontype']){
	if($urls){
		$get=duo_curl($urls);
	}
	if($_GET['get']==1){
		print_r($get);
	}
}
exit('Ok!');